import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
// 数据验证
import { IsNotEmpty, IsEmail } from 'class-validator';
export class CreateUserDto {
  @ApiProperty({ description: '用户名', example: 'admin' })
  @IsNotEmpty({ message: '用户名不能为空' })
  readonly username: string;
  
  @ApiProperty({ description: '密码', example: '123456' })
  @IsNotEmpty({ message: '密码不能为空' })
  readonly password: string;

  @ApiPropertyOptional({ description: '性别', example: '男' })
  readonly sex: string;

  @ApiProperty({ description: '邮箱', example: '123456@qq.com' })
  @IsEmail({},{ message: '邮箱格式不正确' })
  @IsNotEmpty({ message: '邮箱不能为空' })
  readonly email: string;

  @ApiPropertyOptional({ description: '备注', example: '备注' })
  readonly remark: string;
}
